package com.olt.server.power;

import com.olt.dao.user.IPowerDao;
import com.olt.domain.user.OltPower;
import com.olt.result.TreeResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.LinkedList;
import java.util.List;

@Service
public class PowerSevere {
    @Autowired
    IPowerDao iPowerDao;
    public List<TreeResult<OltPower>> getOltPowers(){
        List<OltPower> oltPowers=iPowerDao.findAll();
        List<TreeResult<OltPower>> res=new LinkedList<>();
        for(OltPower oltPower:oltPowers){
            res.add(new TreeResult<>(
                    oltPower,
                    oltPower.getPowerName(),
                    oltPower.getParentName(),
                    oltPower.getPowerName()+'-'+oltPower.getPowerNameZh()
            ));
        }
        return res;
    }


}
